package com.ruoyi.mes.material.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mes.material.mapper.SmesMaterialStockDetailMapper;
import com.ruoyi.mes.material.domain.SmesMaterialStockDetail;
import com.ruoyi.mes.material.service.ISmesMaterialStockDetailService;

/**
 * 原料出入库Service业务层处理
 *
 * @author simpsense
 * @date 2020-12-15
 */
@Service
public class SmesMaterialStockDetailServiceImpl implements ISmesMaterialStockDetailService
{
    @Autowired
    private SmesMaterialStockDetailMapper smesMaterialStockDetailMapper;

    /**
     * 查询原料出入库
     *
     * @param rowId 原料出入库ID
     * @return 原料出入库
     */
    @Override
    public SmesMaterialStockDetail selectSmesMaterialStockDetailById(Long rowId)
    {
        return smesMaterialStockDetailMapper.selectSmesMaterialStockDetailById(rowId);
    }

    /**
     * 查询原料出入库列表
     *
     * @param smesMaterialStockDetail 原料出入库
     * @return 原料出入库
     */
    @Override
    public List<SmesMaterialStockDetail> selectSmesMaterialStockDetailList(SmesMaterialStockDetail smesMaterialStockDetail)
    {
        return smesMaterialStockDetailMapper.selectSmesMaterialStockDetailList(smesMaterialStockDetail);
    }

    /**
     * 新增原料出入库
     *
     * @param smesMaterialStockDetail 原料出入库
     * @return 结果
     */
    @Override
    public int insertSmesMaterialStockDetail(SmesMaterialStockDetail smesMaterialStockDetail)
    {
        smesMaterialStockDetail.setCreateTime(DateUtils.getNowDate());
        smesMaterialStockDetail.setCreateBy(SecurityUtils.getUsername());
        return smesMaterialStockDetailMapper.insertSmesMaterialStockDetail(smesMaterialStockDetail);
    }

    /**
     * 修改原料出入库
     *
     * @param smesMaterialStockDetail 原料出入库
     * @return 结果
     */
    @Override
    public int updateSmesMaterialStockDetail(SmesMaterialStockDetail smesMaterialStockDetail)
    {
        smesMaterialStockDetail.setUpdateTime(DateUtils.getNowDate());
        smesMaterialStockDetail.setUpdateBy(SecurityUtils.getUsername());
        return smesMaterialStockDetailMapper.updateSmesMaterialStockDetail(smesMaterialStockDetail);
    }

    /**
     * 批量删除原料出入库
     *
     * @param rowIds 需要删除的原料出入库ID
     * @return 结果
     */
    @Override
    public int deleteSmesMaterialStockDetailByIds(Long[] rowIds)
    {
        return smesMaterialStockDetailMapper.deleteSmesMaterialStockDetailByIds(rowIds);
    }

    /**
     * 删除原料出入库信息
     *
     * @param rowId 原料出入库ID
     * @return 结果
     */
    @Override
    public int deleteSmesMaterialStockDetailById(Long rowId)
    {
        return smesMaterialStockDetailMapper.deleteSmesMaterialStockDetailById(rowId);
    }
}